package com.youchu.pattern.design.behavioral.chain.handler;

import com.youchu.pattern.design.behavioral.chain.entity.User;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

// 具体处理器 - 验证邮箱
@Component
@Order(300)
public class EmailRegisterHandler extends AbstractRegisterHandler {
    public void handleRequest(User user) {
        if (user.getEmail() == null || !user.getEmail().contains("@")) {
            throw new RuntimeException("邮箱格式不正确");
        }
        next.handleRequest(user);

    }
}